package gspushmq.v1.websocket.core;

import java.io.IOException;

import gspushmq.util.GGLogger;


/**
 * GGPusher对象，不提供给外部访问
 * @author yaoqiang
 *
 */
public enum GGPusherEnum {
	pusher;
	
	private GGWebSocket  ggwskt = null;
	public GGWebSocket getPusher(){
		return ggwskt;
	}
	public void init(GGWebSocket push){
		ggwskt = push;
		if(null != ggwskt){
			ggwskt.start();
		}
	}
	
	public void destory() {
		if(null != ggwskt) {
			try {
				ggwskt.stop();
			} catch (IOException | InterruptedException e) {
				GGLogger.error(GGPusherEnum.class, e, "关闭websocket连接异常");
			}
		}
	}
	
}
